from fastapi import APIRouter,Depends

from backend.app.app.models.project_data import my_save_out_data
from backend.app.app.api.api_v1.user import verify_token_user
from backend.app.app.crud_pro.tb_userpro_out import out_data_add

out_router = APIRouter(prefix="/out_data", tags=["输出数据"])

# hzc 改
@out_router.post("/save_lib",name="存库")
async  def save_lib(data: my_save_out_data,ver=Depends(verify_token_user)):
    result = out_data_add(data.data)
    return {
        'result': result if result else {},
        'verify': ver
    }








    # #add
    # a = False
    # for i in out_data.add:
    #     if i :
    #         a = out_data_add(i)
    # #delete
    # b = False
    # for j in out_data.delete:
    #     if j:
    #         b = out_del(j)
    # #modify
    # c = False
    # for k in out_data.modify:
    #     if k:
    #         c = out_updata(k)
    # return {"add":a,"modify":c,"delete":b,"verify":ver}